<?php 
/**
 * 沈阳校园微信导航----地图展示界面
 * @author zsl
 * @com   沈阳微拓科技有限公司
 */
 // 初始化参数
 $x = 12324.7583;
 $y = 4150.7051;
 
 if(!empty($_GET['x']) && !empty($_GET['y'])) {
	 $x = $_GET['x'];
	 $y = $_GET['y'];
 }
 // 进行转换
 $x = Trans((float)$x);
 $y = Trans((float)$y);
 // 进行get请求
 $url = "http://restapi.amap.com/v3/assistant/coordinate/convert?coordsys=gps&key=58f9485c9351685dd664ab0586b35409&locations=".$x.",".$y;
 $result = file_get_contents($url);
 $tem = json_decode($result, true);
 $tems = explode(",", $tem['locations']);
 
 function Trans($math) {
	$x1 = floor($math / 100.0);
	$y1 = ($math - $x1 * 100) / 60.0;
	return $x1 + $y1;
 }
 
?>

<!--
 地图展示界面
-->
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>校车位置</title>
    <style>
        body,#mapContainer{
            margin:0;
            height:100%;
            width:100%;
            font-size:12px;
        }
    </style>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main.css?v=1.0?v=1.0" />
    <script src="http://cache.amap.com/lbs/static/es5.min.js"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=d449d5d0d2483ce111c3aea57507b67c"></script>
	<script src="./js/jquery.1.7.1.min.js"></script>
    <script>
	var map;
	var marker;
	
        function init() {
            map = new AMap.Map("mapContainer", {
                zoom: 16,
                center:[<?php echo($tems[0].",".$tems[1]); ?>]
            });
            marker = new AMap.Marker({
                map:map,
                position:[<?php echo($tems[0].",".$tems[1]); ?>]
            })
        }
		
		
		
		
    </script>
</head>
<body onload="init()">
    <div id="mapContainer" ></div>
    
</body>
</html>